function Axios(url) {
    this.url = url;
    this.headers = {
        "Content-Type": "application/json",
        token: "token",
    };
}
Axios.prototype.get = function (url, params) {
    const headers = this.headers;
    const checkStatus = (res) => {
        if (res.status === 200) {
            return res;
        }
        console.warn("请求失败");
    };
    return fetch(url, {
        method: "get",
        headers,
    })
        .then((res) => checkStatus(res))
        .then((res) => res.json());
};
Axios.prototype.post = function (url, params) {
    const headers = this.headers;
    return fetch(url, {
        method: "post",
        headers,
        body: JSON.stringify(params),
    });
};
const axios = new Axios();